/*
 * @Author: guandeshen 295570679@qq.com
 * @Date: 2024-05-08 23:51:45
 * @LastEditors: guandeshen 295570679@qq.com
 * @LastEditTime: 2024-05-19 10:44:29
 * @FilePath: /vue3-element-admin/src/api/auth/index.ts
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
import request from "@/utils/request";
import { LoginData, LoginResult } from "./model";

class AuthAPI {
  /**
   * 登录API
   *
   * @param data {LoginData}
   * @returns
   */
  static login(data: LoginData) {
    const formData = new FormData();
    formData.append("account", data.username);
    formData.append("password", data.password);
    return request<any, LoginResult>({
      url: "/tenant/user/login",
      method: "post",
      data: formData,
      headers: {
        "Content-Type": "application/json",
      },
    });
  }

  /**
   * 注销API
   */
  static logout() {
    return request({
      url: "/api/v1/auth/logout",
      method: "delete",
    });
  }
}

export default AuthAPI;
